package cn.edu.scau.cmi.xiaowenyang.client;

import cn.edu.scau.cmi.xiaowenyang.classAdapterMethod.Adapter;
import cn.edu.scau.cmi.xiaowenyang.classAdapterMethod.USBTypeC;
import javafx.application.Application;
import javafx.event.EventHandler;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.TextArea;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.Pane;
import javafx.stage.Stage;

public class ClassAdapterMethodClient extends Application {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		launch(args);
	}

	@Override
	public void start(Stage primaryStage) throws Exception {
		// TODO Auto-generated method stub
		primaryStage.setTitle("类适配器模式");
		Pane pane = new Pane();
		Button button = new Button("显示");
		TextArea textArea = new TextArea();
		button.setOnMouseClicked(new EventHandler<MouseEvent>() {
			@Override
			public void handle(MouseEvent event) {
				// TODO Auto-generated method stub
				USBTypeC Mi5 = new Adapter();
				textArea.setText(Mi5.isUSBTypeC());
			}

		});

		button.setLayoutX(600);
		button.setLayoutY(100);

		textArea.setPrefHeight(300);
		textArea.setPrefWidth(500);
		textArea.setLayoutX(0);
		textArea.setLayoutY(0);
		textArea.setEditable(false);

		pane.getChildren().addAll(textArea, button);
		primaryStage.setScene(new Scene(pane, 700, 500));
		primaryStage.show();
	}

}
